/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2021.
 * Description: hisi timer driver
 * Author: yanbo <joey.yanbo@huawei.com>
 * Create: 2020-11-19
 */
#ifndef ASM_ARM_HARDWARE_ARM_TIMER_H
#define ASM_ARM_HARDWARE_ARM_TIMER_H

/*
 * ARM timer implementation, found in Integrator, Versatile and Realview
 * platforms.  Not all platforms support all registers and bits in these
 * registers, so we mark them with A for Integrator AP, C for Integrator
 * CP, V for Versatile and R for Realview.
 *
 * Integrator AP has 16-bit timers, Integrator CP, Versatile and Realview
 * can have 16-bit or 32-bit selectable via a bit in the control register.
 *
 * Every SP804 contains two identical timers.
 */
#define TIMER_1_BASE	0x00
#define TIMER_2_BASE	0x40

#define TIMER_RELOAD_L     0x000
#define TIMER_RELOAD_H     0x004
#define TIMER_VALUE_L      0x008
#define TIMER_VALUE_H      0x00C
#define TIMER_CONTROL      0x010
#define TIMER_INTCLR       0x014
#define TIMER_RIS          0x018
#define TIMER_MIS          0x01C
#define TIMER_BGLOAD_L     0x020
#define TIMER_BGLOAD_H     0x024

#define TIMER_CTRL_ONESHOT      (1 << 0)        /*  CVR */
#define TIMER_CTRL_64BIT        (1 << 1)        /*  CVR */
#define TIMER_CTRL_DIV1         (0 << 2)        /* ACVR */
#define TIMER_CTRL_DIV16        (1 << 2)        /* ACVR */
#define TIMER_CTRL_DIV256       (2 << 2)        /* ACVR */
#define TIMER_CTRL_IE           (1 << 5)        /*   VR */
#define TIMER_CTRL_PERIODIC     (1 << 6)        /* ACVR */
#define TIMER_CTRL_ENABLE       (1 << 7)        /* ACVR */

#endif
